package dxn.nl.export.deal.export;

import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.concurrent.*;

@Slf4j
@Component
public class ExportCheckManager {

    public static ScheduledExecutorService pool = Executors.newScheduledThreadPool(1);

    @PostConstruct
    public void init()
    {
        pool.execute(()->{
            try{
                ExportSessionManager.checkTimeOut();
            }
            catch (Exception ex)
            {
                log.error("",ex);
            }
        });
    }

    @PreDestroy
    public void destory()
    {
        pool.shutdownNow();
    }
}
